-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for eth68 #4866
Add support for eth68 #4866
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct, now we need to test it with Geth nodes supporting eth/68
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V68/Eth68ProtocolHandler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V68/Eth68ProtocolHandler.cs
Outdated
Show resolved
Hide resolved
...d.Network/P2P/Subprotocols/Eth/V68/Messages/NewPooledTransactionHashesMessageSerializer68.cs
Outdated
Show resolved
Hide resolved
Code looks good to me. How was it tested with Geth? Which scenarios we have covered? Do you consider it as ready to merge? |
I removed all eth protocols except eth68. Started new geth node with current master and connected them together. It looks like those two nodes are the only eth68-compatible nodes in sepolia network. Btw I can share geth node address and you can double-check everything, should be pretty fast I think it's ready to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I runned eth protocol hive tests, looks like we have some regression:
https://github.com/NethermindEth/nethermind/actions/runs/3445494354/jobs/5749273330
With TestBlockHashAnnounce
and TestOldAnnounce
we had problems before, but failing TestTransaction
and TestLargeTxRequest
is a regression
"14":{"name":"TestTransaction (nethermind)","description":"","start":"2022-11-11T13:55:19.464384531Z","end":"2022-11-11T13:55:19.465879952Z","summaryResult":{"pass":false,"details":" Testing tx propagation 0: sending tx 0x7d58c33ec2867fd7f9631b31258468d8b1b9cf71f57672e12eacc4e5a63ed84a 1000000 134172\n send successful tx test failed: unexpected message in sendSuccessfulTx: (*ethtest.Error)(could not rlp decode message: rlp: value size exceeds available input length)\n \n"},"clientInfo":null},
"16":{"name":"TestLargeTxRequest (nethermind)","description":"","start":"2022-11-11T13:55:19.491286912Z","end":"2022-11-11T13:55:19.492174225Z","summaryResult":{"pass":false,"details":" failed to send next block: failed to announce block: unexpected: (*ethtest.Error)(could not rlp decode message: rlp: value size exceeds available input length)\n \n"},"clientInfo":null},
Looks like there is still something wrong with rlp
That's strange
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestTransaction
is fixed. We are still sometimes failing TestLargeTxRequest
(which requires us to send 2000 txs), but it is because of timeout in sending block (https://github.com/ethereum/go-ethereum/blob/master/cmd/devp2p/internal/ethtest/suite.go#L458) so doesn't look connected with this PR - looks like we had this issue before and didn't noticed. On the other hand, it would be good to change the moment of calculating tx sizes to limit CPU usage - more details in comment to code
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V68/Eth68ProtocolHandler.cs
Outdated
Show resolved
Hide resolved
One more thing - we will need to change our behavior in sending full txs. Right now we are limiting it to 256 txs (https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Network/P2P/ProtocolHandlers/SyncPeerProtocolHandlerBase.cs#L200), but after introducing new type of txs it might be too much. After merging this PR we will have calculated tx sizes, so will be able to do it same as Geth - limit by data size instead of tx count. But this is definitely another task, I will create issue |
# Conflicts: # src/Nethermind/Nethermind.Core/Transaction.cs # src/Nethermind/Nethermind.Network.Test/Builders/SerializationBuilder.cs # src/Nethermind/Nethermind.Network/Metrics.cs # src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V65/IPooledTxsRequestor.cs # src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V65/PooledTxsRequestor.cs # src/Nethermind/Nethermind.Serialization.Rlp/TxDecoder.cs
This reverts commit 77701f6.
This reverts commit 648e156.
...d.Network/P2P/Subprotocols/Eth/V68/Messages/NewPooledTransactionHashesMessageSerializer68.cs
Outdated
Show resolved
Hide resolved
_handler.ProtocolCode.Should().Be("eth"); | ||
_handler.Name.Should().Be("eth68"); | ||
_handler.ProtocolVersion.Should().Be(68); | ||
_handler.MessageIdSpaceSize.Should().Be(17); | ||
_handler.IncludeInTxPool.Should().BeTrue(); | ||
_handler.ClientId.Should().Be(_session.Node?.ClientId); | ||
_handler.HeadHash.Should().BeNull(); | ||
_handler.HeadNumber.Should().Be(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do the whole comparision:
_handler.Should().BeEquivalentTo(expectedHandler)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is an updated copy-paste of metadata tests for older protocols. Purpose of this test is to check if metadata are correct and it is doing it perfectly. If we create another instance o Eth68ProtocolHandler
and compare equivalence with _handler
, we will still don't know if these details are correct in both or wrong in both of them. It is not overwritable from the outside, so no way to ensure correctness of expectedHandler
...nd.Network.Test/P2P/Subprotocols/Eth/V68/NewPooledTransactionHashesMessageSerializerTests.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V65/PooledTxsRequestor.cs
Outdated
Show resolved
Hide resolved
|
||
public void Serialize(IByteBuffer byteBuffer, NewPooledTransactionHashesMessage68 message) | ||
{ | ||
byte[] types = message.Types.Select(v => (byte)v).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok ToArray
is not needed if you add method overloads with IReadOnlyList
, can we do that?
* eth68 implementation * test * refactor serializer * change typesSize back * Tests and enable capability * serializer tests * Fix whitespaces * fix whitespaces * Refactor * Fix serialization & peer drop * RequestTransactions68 * Metrics & logs * Reduce paket max size * Calculate length properly * fix tests & length * huge transaction test * fix spaces * Make size calculated once per transaction * Refactor & optimizations * Fix hive tests * Copyright fix * ubuntu 20.04 workflow * Revert "ubuntu 20.04 workflow" This reverts commit 77701f6. * Revert "Revert "ubuntu 20.04 workflow"" This reverts commit 648e156. * Remove metrics & for loop * Remove test & RequestTransactionsEth68 * EncodeList implementation * Fix test * Revert renaming * Rename write * Remove Request68 * Fix run-nethermind-tests.yml * Fix run-nethermind-tests.yml Co-authored-by: Marcin Sobczak <marcindsobczak@gmail.com>
* eth68 implementation * test * refactor serializer * change typesSize back * Tests and enable capability * serializer tests * Fix whitespaces * fix whitespaces * Refactor * Fix serialization & peer drop * RequestTransactions68 * Metrics & logs * Reduce paket max size * Calculate length properly * fix tests & length * huge transaction test * fix spaces * Make size calculated once per transaction * Refactor & optimizations * Fix hive tests * Copyright fix * ubuntu 20.04 workflow * Revert "ubuntu 20.04 workflow" This reverts commit 77701f6. * Revert "Revert "ubuntu 20.04 workflow"" This reverts commit 648e156. * Remove metrics & for loop * Remove test & RequestTransactionsEth68 * EncodeList implementation * Fix test * Revert renaming * Rename write * Remove Request68 * Fix run-nethermind-tests.yml * Fix run-nethermind-tests.yml Co-authored-by: Marcin Sobczak <marcindsobczak@gmail.com>
* eth68 implementation * test * refactor serializer * change typesSize back * Tests and enable capability * serializer tests * Fix whitespaces * fix whitespaces * Refactor * Fix serialization & peer drop * RequestTransactions68 * Metrics & logs * Reduce paket max size * Calculate length properly * fix tests & length * huge transaction test * fix spaces * Make size calculated once per transaction * Refactor & optimizations * Fix hive tests * Copyright fix * ubuntu 20.04 workflow * Revert "ubuntu 20.04 workflow" This reverts commit 77701f6. * Revert "Revert "ubuntu 20.04 workflow"" This reverts commit 648e156. * Remove metrics & for loop * Remove test & RequestTransactionsEth68 * EncodeList implementation * Fix test * Revert renaming * Rename write * Remove Request68 * Fix run-nethermind-tests.yml * Fix run-nethermind-tests.yml Co-authored-by: Marcin Sobczak <marcindsobczak@gmail.com>
Fixes | Closes | Resolves #
Changes:
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyTesting
Requires testing
In case you checked yes, did you write tests??
Comments about testing , should you have some (optional)
We should test it against geth, as they have eth68 merged